<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" charset="utf-8">
        /**
         * 父类
         * @param name
         * @param age
         * @constructor
         */
        function Person(name,age) {
            this.name = name;
            this.age = age;
        }

        /**
         * 父类原型对象属性
         * @type {number}
         */
        Person.prototype.id = 10;
        function Boy(sex) {
            this.sex = sex;
        }
        //原型继承，既继承了父类的模板，又继承了父类的原型对象
        Boy.prototype = new Person('张三');
        var boy = new Boy();
        alert(boy.name);
        alert(boy.id);
    </script>
</head>
<body>
</body>
</html>